
cmake_minimum_required(VERSION 2.8)

SET(PROJ_NAME "vtkAmbientOcclusionPass")

OPTION(VTK_AO_PASS_PYTHON "Python wrappings for the ambient occlusion rendering pass in VTK" OFF)
OPTION(VTK_AO_PASS_EXAMPLE "Example project which shows how to use the ambient occlusion rendering pass" OFF)

PROJECT(${PROJ_NAME})

INCLUDE_DIRECTORIES(
	${CMAKE_CURRENT_BINARY_DIR}
	${CMAKE_CURRENT_SOURCE_DIR}
)

IF(NOT VTK_BINARY_DIR)
	FIND_PACKAGE(VTK)
	IF(NOT VTK_DIR)
		MESSAGE(FATAL_ERROR "Please set VTK root directory")
	ENDIF(NOT VTK_DIR)
	INCLUDE(${VTK_USE_FILE})
ENDIF(NOT VTK_BINARY_DIR)

INCLUDE(CMakeOptions.cmake)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_EXPORTING")

SET(Source vtkAmbientOcclusionPass.cpp)

SOURCE_GROUP("source" FILES ${Source})

ADD_LIBRARY(${PROJ_NAME} ${Source})

# if (MSVC)
   # set_target_properties(${PROJ_NAME} PROPERTIES COMPILE_FLAGS "/YuvtkAOStable.h")
   # set_source_files_properties(vtkAOStable.cpp PROPERTIES COMPILE_FLAGS "/YcvtkAOStable.h")
# endif(MSVC)

TARGET_LINK_LIBRARIES(${PROJ_NAME} vtkCommon vtkRendering vtkGraphics vtkVolumeRendering OpenGL32.lib)

if(VTK_AO_PASS_PYTHON)
	IF(VTK_WRAP_PYTHON)
		INCLUDE_DIRECTORIES("${PYTHON_INCLUDE_PATH}")
			
		SET(WrapPython vtkAmbientOcclusionPass.cpp)
		
		VTK_WRAP_PYTHON3(${PROJ_NAME}Python vtkAmbientOcclusionPass_SRCS "${WrapPython}")

		ADD_LIBRARY(${PROJ_NAME}PythonD ${vtkAmbientOcclusionPass_SRCS})
		PYTHON_ADD_MODULE(${PROJ_NAME}Python ${PROJ_NAME}PythonInit.cxx)
		
		TARGET_LINK_LIBRARIES(${PROJ_NAME}Python ${PROJ_NAME}PythonD)
		TARGET_LINK_LIBRARIES(${PROJ_NAME}PythonD ${PROJ_NAME} vtkCommonPythonD vtkRenderingPythonD vtkGraphicsPythonD vtkVolumeRenderingPythonD)
	ENDIF(VTK_WRAP_PYTHON)
ENDIF(VTK_AO_PASS_PYTHON)

IF(VTK_AO_PASS_EXAMPLE)
	ADD_EXECUTABLE(${PROJ_NAME}Example vtkAmbientOcclusionPassExample.cpp)
	TARGET_LINK_LIBRARIES(${PROJ_NAME}Example ${PROJ_NAME})
ENDIF(VTK_AO_PASS_EXAMPLE)
